home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / timersp.com / TSTTMR.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1990-10-22  |  1.4 KB  |  57 lines

  1. {$M $1000,$1000,$1000}
  2. {$R+}     { Range checking on            }
  3. {$B-}     { Boolean complete evaluation off  }
  4. {$S-}     { Stack checking off            }
  5. {$I-}     { I/O checking off            }
  6. {$V-}     { Relaxed variable checking        }
  7.  
  8. Program TestTmr;
  9.  
  10. Uses Crt, Dos, Timers;
  11.  
  12. var
  13. R : Registers;
  14.  
  15. (*****************************************************************************)
  16.  
  17. procedure CursorOff;                    { Turn off the cursor }
  18.    begin
  19.    with R do
  20.       begin
  21.       AX := 1*$100;                 { Set cursor size to nothing     }
  22.       CX := $2000;                 { Set bit 5 in CH for cursor off }
  23.       intr ($10,Dos.Registers(R));
  24.       end;
  25.    end;
  26.  
  27. procedure CursorOn;                     { Turn on the cursor }
  28.    begin
  29.    with R do
  30.       begin
  31.       AX := 1*$100;                    { Set cursor size          }
  32.       CX := $1010;                    { Set cursor to underline }
  33.       intr ($10,Dos.Registers(R));
  34.       end;
  35.    end;
  36.  
  37. (*****************************************************************************)
  38.  
  39.    begin
  40.    ClrScr;
  41.    CursorOff;
  42.    TimerCounter := 10000;
  43.    InitTimerInterupt;               { Grabs timer vector and reroutes it }
  44.    GoToXY (25, 24);
  45.    write ('Press any key to exit');
  46.  
  47.    repeat
  48.       GoToXY (30, 12);              { TimerCounter is being decremented }
  49.       write (TimerCounter : 5);       {  by the interrupt routine          }
  50.    until keypressed OR (TimerCounter = 0);
  51.  
  52.    ReleaseTimerInterupt;         { Restores old vector }
  53.    CursorOn;
  54.    ClrScr;
  55.    end.
  56.  
  57.